/*
 * CAN_Communication.h
 *
 *  Created on: Oct 28, 2019
 *      Author: nxa07657
 */

#ifndef CAN_COMMUNICATION_H_
#define CAN_COMMUNICATION_H_

#include "Cpu.h"

#define CAN_RX_Buffer_MAX 2

/* used for FlexCAN TX/RX interrupt test */
extern can_message_t CAN_TxMsg;  /* for CAN TX  */
extern can_message_t *CAN_RxMsg;  /* for CAN RX  */

extern uint32_t CAN_RX_BufferIndex;
extern can_message_t CAN_RX_Message_Buffer[CAN_RX_Buffer_MAX];

extern uint8_t CAN_BufferReceive_Flag;  /* FlexCAN received CAN frame flag */

extern void CAN_TX_RX_Callback(uint32_t instance, can_event_t eventType, uint32_t objIdx, void *driverState);

extern status_t CAN_CommunicationInit(void);
extern status_t CAN_TransmitMsg(uint32_t mb_num, can_message_t * msg);

#endif /* CAN_COMMUNICATION_H_ */
